#include "NoteIndex.h"
#include "KadClog.h"

using namespace std;

void
NoteIndex::addNotes(CUInt128 &target, SimpleTagList &tagList) {
  notesMap_[target] = tagList;
}

void
NoteIndex::addNotes(CUInt128 &target, const char *fileName, uint32 fileSize) {
  SimpleTagList tagList;
  tagList.push_back(SimpleTag(std::string(fileName)));
  tagList.push_back(SimpleTag(fileSize));
  addNotes(target, tagList);
}

SimpleTagList
NoteIndex::getNote(CUInt128 &target) const {
  NotesMap::const_iterator i = notesMap_.find(target);
  if (i == notesMap_.end()) {
    throw std::exception();
  }
  return i->second;
}
